package com.cxhc.app.api.hcdoc;

import com.cxhc.app.api.hcdoc.vo.HdProjectDocInfoVo;
import com.cxhc.app.api.mapper.hcdoc.HdProjectDocInfoMapStructMapper;
import com.cxhc.common.core.controller.BaseController;
import com.cxhc.common.core.domain.AjaxResult;
import com.cxhc.common.core.page.TableDataInfo;
import com.cxhc.system.domain.hcdoc.HdProjectDocInfo;
import com.cxhc.system.service.hcdoc.HdProjectDocInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 项目信息Controller
 *
 * @author Dhq
 * @date 2024-08-14
 */
@RestController
@RequestMapping("/api/hcDoc/projectDoc")
public class HdProjectDocInfoApi extends BaseController {

    @Autowired
    private HdProjectDocInfoService hdProjectDocInfoService;

    /**
     * 查询项目信息列表
     */
    @GetMapping("/list")
    public TableDataInfo list(HdProjectDocInfoVo hdProjectDocInfoVo) {
        HdProjectDocInfo hdProjectDocInfo = HdProjectDocInfoMapStructMapper.INSTANCE.HdProjectDocInfoVoToHdProjectDocInfo(hdProjectDocInfoVo);
        startPage();
        return getDataTable(hdProjectDocInfoService.selectList(hdProjectDocInfo));
    }

    /**
     * 更新项目信息信息
     */
    @RequestMapping("/update")
    public AjaxResult update(@RequestBody List<HdProjectDocInfoVo> hdProjectDocInfoVos) {
        List<HdProjectDocInfo> hdProjectDocInfo = HdProjectDocInfoMapStructMapper.INSTANCE.HdProjectDocInfoVoToHdProjectDocInfo(hdProjectDocInfoVos);
        return toAjax(hdProjectDocInfoService.update(hdProjectDocInfo));
    }

}
